//初始化全局参数

var dataResult = {};//ajax响应后台返回值
var dataResult2 = {};//备用2
var dataResult3 = {};//备用3
var sucmsg = "";


//封装的ajax方法---全局调用---
function getAgentMsg(param,method,datas){
	$.ajax({
		url: url + param,
		type: method,
		dataType: 'json',
		data:JSON.stringify(datas),
		async:false,
		contentType: "application/json",
		useDefaultXhrHeader: false,
		 beforeSend: function(XMLHttpRequest) {
			XMLHttpRequest.setRequestHeader("X-Token", token); 
		},
		success: function(result) {
			if(result.code == '0') {
				dataResult = result;
//				console.log(dataResult);
				
			} else {
				layer.msg(result);
			}
		},
		err: function(err) {
			layer.msg("请求失败");
		}
	});
}


//备用的ajax2.
function getAgentMsg2(param2,method2,datas2){
	$.ajax({
		url: url + param2,
		type: method2,
		dataType: 'json',
		data:JSON.stringify(datas2),
		async:false,
		contentType: "application/json",
		useDefaultXhrHeader: false,
		 beforeSend: function(XMLHttpRequest) {
			XMLHttpRequest.setRequestHeader("X-Token", token); 
		},
		success: function(result) {
//		console.log(result);
			if(result.code == '0') {
				dataResult2 = result;
			} else {
				layer.msg(result);
			}
		},
		err: function(err) {
			layer.msg("请求失败");
		}
	});
}

//备用的ajax3.
function getAgentMsg3(param3,method3,datas3){
	$.ajax({
		url: url + param3,
		type: method3,
		dataType: 'json',
		data:JSON.stringify(datas3),
		async:false,
		contentType: "application/json",
		useDefaultXhrHeader: false,
		 beforeSend: function(XMLHttpRequest) {
			XMLHttpRequest.setRequestHeader("X-Token", token); 
		},
		success: function(result) {
//			console.log(result);
			if(result.code == '0') {
				dataResult3 = result;

			} else {
				layer.msg(result);
			}
		},
		err: function(err) {
			layer.msg("请求失败");
		}
	});
}





